import java.util.Arrays;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 666
 * Date: 2022-11-30
 * Time: 14:56
 */
public class test1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a=scanner.nextInt();
        int[] arr=new int[a];
        for (int i = 0; i < arr.length; i++) {
           arr[i]=scanner.nextInt();
        }
        Arrays.sort(arr);
        int b=0;
        int c=0;
        while (b<a-2){
            if((arr[b]+1==arr[b+1])&&(arr[b]+2==arr[b+2])){
                c+=1;
                b+=3;
            }else {
                b++;
            }
        }
        System.out.println(c);
    }
}
